package eteam.aps.controller;

import eteam.aps.common.R;
import eteam.aps.common.exceptions.AuthException;
import eteam.aps.common.helper.JsonPage;
import eteam.aps.model.entity.Worksheet;
import eteam.aps.model.vo.WorksheetVo;
import eteam.aps.systeminterface.model.vo.QueryInfoVo;
import eteam.aps.systeminterface.model.vo.Worksheets;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 单据流水号控制器
 *
 * @author WMT
 * @Date 2023/2/17 14:14
 */
public interface IWorksheetController {

    @PostMapping("/work/insert")
    R<Integer> insert(@RequestBody Worksheet worksheet) throws Exception, AuthException;

    @PostMapping("/work/delete/{fId}")
    R<Integer> delete(@PathVariable String fId) throws Exception, AuthException;

    @PostMapping("/work/update")
    R<Integer> update(@RequestBody Worksheet worksheet) throws Exception, AuthException;

    @PostMapping("/work/selectAll")
    R<JsonPage<WorksheetVo>> selectAll(
            @RequestParam("systemId") Integer systemId,
            @RequestParam(value = "fWorksheetName",required = false) String fWorksheetName,
            @RequestParam(value = "fWorksheetCode",required = false) String fWorksheetCode,
            @RequestParam("page") Integer page,@RequestParam("pageSize") Integer pageSize
    ) throws Exception, AuthException;

    @PostMapping("/work/sheetTypeList/{order}")
    R<List<QueryInfoVo>> sheetTypeList(@PathVariable int order) throws Exception, AuthException;

    @PostMapping("/work/selectDetails/{fId}")
    R<WorksheetVo> selectDetails(@PathVariable String fId) throws Exception, AuthException;

    @PostMapping("/work/selectSheetPrefix/{sheetCode}")
    Worksheets selectSheetPrefix(@PathVariable String sheetCode) throws Exception, AuthException;

    @PostMapping("/work/selectDdByWorksheetType")
    List<QueryInfoVo> selectDdByWorksheetType() throws Exception, AuthException;

    @PostMapping("/work/selectCodeByWorksheetName/{name}")
    QueryInfoVo selectCodeByWorksheetName(@PathVariable String name) throws Exception, AuthException;

    @PostMapping("/work/selectNameByCode/{code}")
    QueryInfoVo selectNameByCode(@PathVariable String code) throws Exception, AuthException;

}
